lib/repo: Add a DEVINO_CANONICAL commit modifier flag
authorColin Walters <walters@verbum.org>
Fri, 1 Dec 2017 02:43:17 +0000 (21:43 -0500)
committerAtomic Bot <atomic-devel@projectatomic.io>
Mon, 4 Dec 2017 14:42:37 +0000 (14:42 +0000)
commit7c8ea25306a39c211a877dc134f0a393191a0193
treebf3a6f4e28fd544389f2f97804efc48b58366756
parent5ef8faff9a10f055401df5265e389ba9bbb89786
lib/repo: Add a DEVINO_CANONICAL commit modifier flag

I was seeing the `Writing OSTree commit...` phase of rpm-ostree
being very slow lately.  This turns out to be more fallout from
https://github.com/ostreedev/ostree/pull/1170
AKA commit: 8fe4536

Loading the xattrs is slow on my system (F27AW, XFS+LVM, NVMe). I haven't fully
traced through why, but AIUI at least on XFS the xattrs are often stored outside
of the inode so it's a little bit like doing an `open()+read()`. Plus there's
the LSM overhead, etc.

The thing is that for rpm-ostree's package layering use case, we
basically always want to treat the on-disk state as canonical.  (There's
a subtle case here if one does overrides for something that contains
policy but we'll fix that).

Anyways, so we're in a state now where we do the slow but correct thing by
default, which seems sane. But let's allow the app to opt-in to telling us
"really trust devino". The difference between a `stat()` + hash table lookup
versus the full xattr load on my test case of `rpm-ostree install
./tree-1.7.0-10.fc27.x86_64.rpm` is absolutely dramatic; consistently on the
order of 10s without this support, and <1s with (800ms).

Closes: #1357
Approved by: jlebon
src/libostree/ostree-repo-commit.c
src/libostree/ostree-repo.h
src/ostree/ot-builtin-commit.c
tests/test-basic-user.sh